void
broadway_output_new_surface(BroadwayOutput *output,
- int id, int x, int y, int w, int h,
- gboolean is_temp)
+ int id, int x, int y, int w, int h)
{
write_header (output, BROADWAY_OP_NEW_SURFACE);
append_uint16 (output, id);
append_uint16 (output, y);
append_uint16 (output, w);
append_uint16 (output, h);
- append_bool (output, is_temp);
}
void
int x,
int y,
int w,
- int h,
- gboolean is_temp);
+ int h);
void broadway_output_disconnected (BroadwayOutput *output);
void broadway_output_show_surface (BroadwayOutput *output,
int id);
gint32 y;
guint32 width;
guint32 height;
- guint32 is_temp;
} BroadwayRequestNewSurface;
typedef struct {
gint32 y;
gint32 width;
gint32 height;
- gboolean is_temp;
gboolean visible;
gint32 transient_for;
guint32 texture;
int x,
int y,
int width,
- int height,
- gboolean is_temp)
+ int height)
{
BroadwaySurface *surface;
surface->id = server->id_counter++;
surface->x = x;
surface->y = y;
- if (x == 0 && y == 0 && !is_temp)
- {
- /* TODO: Better way to know if we should pick default pos */
- surface->x = 100;
- surface->y = 100;
- }
surface->width = width;
surface->height = height;
- surface->is_temp = is_temp;
surface->node_lookup = g_hash_table_new (g_direct_hash, g_direct_equal);
g_hash_table_insert (server->surface_id_hash,
surface->x,
surface->y,
surface->width,
- surface->height,
- surface->is_temp);
+ surface->height);
else
fake_configure_notify (server, surface);
surface->x,
surface->y,
surface->width,
- surface->height,
- surface->is_temp);
+ surface->height);
}
/* Then do everything that may reference other surfaces */
int x,
int y,
int width,
- int height,
- gboolean is_temp);
+ int height);
void broadway_server_destroy_surface (BroadwayServer *server,
gint id);
gboolean broadway_server_surface_show (BroadwayServer *server,
sendInput(BROADWAY_EVENT_CONFIGURE_NOTIFY, [surface.id, surface.x, surface.y, surface.width, surface.height]);
}
-function cmdCreateSurface(id, x, y, width, height, isTemp)
+function cmdCreateSurface(id, x, y, width, height)
{
- var surface = { id: id, x: x, y:y, width: width, height: height, isTemp: isTemp };
- surface.positioned = isTemp;
+ var surface = { id: id, x: x, y:y, width: width, height: height };
surface.transientParent = 0;
surface.visible = false;
surface.imageData = null;
y = cmd.get_16s();
w = cmd.get_16();
h = cmd.get_16();
- var isTemp = cmd.get_bool();
- var div = cmdCreateSurface(id, x, y, w, h, isTemp);
+ var div = cmdCreateSurface(id, x, y, w, h);
display_commands.push([DISPLAY_OP_APPEND_ROOT, div]);
need_restack = true;
break;
var has_size = ops & 2;
surface = surfaces[id];
if (has_pos) {
- surface.positioned = true;
surface.x = cmd.get_16s();
surface.y = cmd.get_16s();
display_commands.push([DISPLAY_OP_MOVE_NODE, surface.div, surface.x, surface.y]);
request->new_surface.x,
request->new_surface.y,
request->new_surface.width,
- request->new_surface.height,
- request->new_surface.is_temp);
+ request->new_surface.height);
client->surfaces =
g_list_prepend (client->surfaces,
GUINT_TO_POINTER (reply_new_surface.id));
int x,
int y,
int width,
- int height,
- gboolean is_temp)
+ int height)
{
BroadwayRequestNewSurface msg;
guint32 serial, id;
msg.y = y;
msg.width = width;
msg.height = height;
- msg.is_temp = is_temp;
serial = gdk_broadway_server_send_message (server, msg,
BROADWAY_REQUEST_NEW_SURFACE);
reply = gdk_broadway_server_wait_for_reply (server, serial);
int x,
int y,
int width,
- int height,
- gboolean is_temp);
+ int height);
void _gdk_broadway_server_destroy_surface (GdkBroadwayServer *server,
gint id);
gboolean _gdk_broadway_server_surface_show (GdkBroadwayServer *server,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->configure_notify.id));
if (surface)
{
- surface->x = message->configure_notify.x;
- surface->y = message->configure_notify.y;
-
- gdk_broadway_surface_update_popups (surface);
-
event = gdk_event_configure_new (surface,
message->configure_notify.width,
message->configure_notify.height);
void _gdk_broadway_surface_grab_check_destroy (GdkSurface *surface);
void _gdk_broadway_surface_grab_check_unmap (GdkSurface *surface,
gulong serial);
-void gdk_broadway_surface_update_popups (GdkSurface *surface);
void gdk_broadway_surface_move_resize (GdkSurface *surface,
gint x,
broadway_display = GDK_BROADWAY_DISPLAY (display);
impl = GDK_BROADWAY_SURFACE (surface);
+ impl->root_x = x;
+ impl->root_y = y;
+ if (parent)
+ {
+ impl->root_x += GDK_BROADWAY_SURFACE (parent)->root_x;
+ impl->root_y += GDK_BROADWAY_SURFACE (parent)->root_y;
+ }
+
impl->id = _gdk_broadway_server_new_surface (broadway_display->server,
- surface->x,
- surface->y,
+ impl->root_x,
+ impl->root_y,
surface->width,
- surface->height,
- surface_type == GDK_SURFACE_TEMP);
+ surface->height);
g_hash_table_insert (broadway_display->id_ht, GINT_TO_POINTER(impl->id), surface);
if (!surface->parent)
return broadway_display->scale_factor;
}
+static void
+sync_child_root_pos (GdkSurface *parent)
+{
+ GdkBroadwaySurface *parent_impl = GDK_BROADWAY_SURFACE (parent);
+ GdkBroadwayDisplay *broadway_display;
+ GList *l;
+
+ broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (parent));
+
+ for (l = parent->children; l; l = l->next)
+ {
+ GdkBroadwaySurface *child_impl = l->data;
+ GdkSurface *child = GDK_SURFACE (child_impl);
+ int root_x, root_y;
+
+ root_x = child->x + parent_impl->root_x;
+ root_y = child->y + parent_impl->root_y;
+
+ if (root_x != child_impl->root_x ||
+ root_y != child_impl->root_y)
+ {
+ child_impl->root_x = root_x;
+ child_impl->root_y = root_y;
+
+ _gdk_broadway_server_surface_move_resize (broadway_display->server,
+ child_impl->id,
+ TRUE,
+ child_impl->root_x, child_impl->root_y,
+ child->width, child->height);
+ sync_child_root_pos (child);
+ }
+ }
+}
+
+/* x, y is relative to parent */
static void
gdk_broadway_surface_move_resize_internal (GdkSurface *surface,
gboolean with_move,
GdkBroadwayDisplay *broadway_display;
gboolean size_changed;
+ if (with_move)
+ {
+ surface->x = x;
+ surface->y = y;
+ impl->root_x = x;
+ impl->root_y = y;
+ if (surface->parent)
+ {
+ GdkBroadwaySurface *parent_impl = GDK_BROADWAY_SURFACE (surface->parent);
+ impl->root_x += parent_impl->root_x;
+ impl->root_y += parent_impl->root_y;
+ }
+ }
+
size_changed = FALSE;
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (surface));
}
}
- if (surface->parent)
- {
- impl->offset_x = x - surface->parent->x;
- impl->offset_y = y - surface->parent->y;
- }
-
_gdk_broadway_server_surface_move_resize (broadway_display->server,
impl->id,
with_move,
- x, y,
+ impl->root_x, impl->root_y,
surface->width, surface->height);
+ sync_child_root_pos (surface);
+
queue_flush (surface);
if (size_changed)
{
layout,
&final_rect);
- gdk_surface_get_origin (surface->parent, &x, &y);
- x += final_rect.x;
- y += final_rect.y;
+ x = final_rect.x;
+ y = final_rect.y;
if (final_rect.width != surface->width ||
final_rect.height != surface->height)
gint *root_x,
gint *root_y)
{
+ GdkBroadwaySurface *impl;
+
+ impl = GDK_BROADWAY_SURFACE (surface);
+
if (root_x)
- *root_x = x + surface->x;
+ *root_x = x + impl->root_x;
if (root_y)
- *root_y = y + surface->y;
+ *root_y = y + impl->root_y;
}
static gboolean
impl->pre_maximize_height);
}
-void
-gdk_broadway_surface_update_popups (GdkSurface *parent)
-{
- GList *l;
-
- for (l = parent ->children; l; l = l->next)
- {
- GdkBroadwaySurface *popup_impl = l->data;
- GdkSurface *popup = GDK_SURFACE (popup_impl);
- int new_x = parent->x + popup_impl->offset_x;
- int new_y = parent->y + popup_impl->offset_y;
-
- if (new_x != popup->x || new_y != popup->y)
- gdk_broadway_surface_move_resize (popup,
- new_x, new_y,
- popup->width, popup->height);
- }
-}
-
typedef struct _MoveResizeData MoveResizeData;
struct _MoveResizeData
GArray *node_data;
GPtrArray *node_data_textures;
- int offset_x;
- int offset_y;
+ int root_x;
+ int root_y;
};
struct _GdkBroadwaySurfaceClass